<?php
/**
 * Created by PhpStorm.
 * User: ulinix
 * Date: 2017/10/12
 * Time: 18:53
 */
namespace Home\Controller;
use Think\Controller;
class CreateController extends Controller
{
    function index(){
        $this->buildHtml("article1111.html", "","Create:q/example");
    }
     protected  function buildHtml($htmlfile='',$htmlpath='',$templateFile='') {
         $content = $this->fetch($templateFile);
         $htmlpath    = !empty($htmlpath)?$htmlpath:HTML_PATH;
         $htmlfile  =   $htmlpath.$htmlfile.C('HTML_FILE_SUFFIX');
         if(!is_dir(dirname($htmlfile)))
             // 如果静态目录不存在 则创建
                mkdir(dirname($htmlfile));
         if(false === file_put_contents($htmlfile,$content))
             throw_exception(L('_CACHE_WRITE_ERROR_').':'.$htmlfile);
         return $content;
     }

}